# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=ldoc
_pkgname=LDoc
pkgver=1.4.6
pkgrel=3
pkgdesc="Documentation tool for Lua"
url="https://github.com/stevedonovan/LDoc"
arch="noarch"
license="MIT"
_luaver=5.4
depends="lua-penlight lua$_luaver" # lua-penlight provides lua5.4-penlight
source="$_pkgname-$pkgver.tar.gz::https://github.com/stevedonovan/$_pkgname/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

prepare() {
	default_prepare
	sed -i "1s:.*:#!/usr/bin/lua$_luaver:" ldoc.lua
	find . -type d | xargs chmod 755
}

package() {
	local lmod_dir="$pkgdir/usr/share/lua/$_luaver"
	install -Dm755 ldoc.lua "$pkgdir"/usr/bin/ldoc

	install -d "$lmod_dir"
	cp -a ldoc "$lmod_dir"/
}

sha512sums="bcaddba4e462a4fb0aa0d8fcff390de3f195fa5cc569d8f05b84ad0fff900f5ac945be7a2eb15cf5ca60cc462f02c874579e4a19e33776178a04104ef9d944af  LDoc-1.4.6.tar.gz"
